package com.source.lightfowl.basedata.dao;

import com.source.lightfowl.basedata.entity.Barcode_Machine_Status;
import org.hibernate.validator.constraints.EAN;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface BarcodeMachineStatusDao extends JpaRepository<Barcode_Machine_Status,String> {

    @Query("from Barcode_Machine_Status s where s.barcodeMachineId = (?1)")
    Barcode_Machine_Status getByBarchodeMachineId(String id1);


    //select  * from 表名 order by 日期字段名 desc 
    @Query("from Barcode_Machine_Status s where s.barcodeMachineId = (?1)")
    List<Barcode_Machine_Status> getRecentByBarchodeMachineId(String id1);

    @Modifying
    @Transactional
    @Query("delete from Barcode_Machine_Status s where s.barcodeMachineId = (?1)")
    void deleteByBarchodeMachineId(String id1);


}
